package commandAction;

import java.awt.Component;
import java.awt.KeyboardFocusManager;

import javax.swing.JDialog;

import com.supermap.desktop.Application;
import com.supermap.desktop.Interface.IDockbar;
import com.supermap.desktop.Interface.IDockbarManager;
import com.supermap.desktop.ui.controls.Dockbar;

import command.CmdDockbar;
import command.Command;

public class ActionDockbar extends Action {
	IDockbar dockBar = null;

	@Override
	public Object action(Command cmd) {
		String title = cmd.getTitle();
		if (title == null) {
			return null;
		}
		dockBar = ActionDockbar.getDockbarByTitle(title);
		if (dockBar == null) {
			return null;
		}
		Component c = ActionUtil.searchComponentByMap((Component) dockBar,
				cmd.getSearchMap());
		return null;
	}

	public static IDockbar getDockbarByTitle(String title) {

		// TODO Auto-generated method stub
		IDockbar dockBar = null;
		IDockbarManager dockbarManager = Application.getActiveApplication()
				.getMainFrame().getDockbarManager();
		for (int i = 0; i < dockbarManager.getCount(); i++) {
			dockBar = (Dockbar) Application.getActiveApplication()
					.getMainFrame().getDockbarManager().get(i);
			if (((Dockbar) dockBar).getTitle().equals(title)) {
				;
				return dockBar;
			}
		}
		return null;
	}

}
